<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/8/18 0018
  Time: 20:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.12.4.js"></script>
    <link href="${pageContext.request.contextPath}/layui/css/layui.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="${pageContext.request.contextPath}/layui/layui.js"></script>

    <script type="text/javascript">

        layui.use('table',function(){

            var table = layui.table;

            table.render({
                elem:"#myTable",//表格的id
                url:"${pageContext.request.contextPath}/log/selectByPageLog",//数据接口 请求地址
                page:true,//开启分页
                <%--//发送的额外参数--%>
                <%--where:{"name":"${param.name}"},--%>
                //顶部工具栏
                toolbar:"#mytoolbar",
                //页面初始大小
                limit:2,
                //页面下拉列表框中的内容
                limits:[3,4,5,10,20,30,50],
                //列
                cols:[[
                    {type:"checkbox"},
                    {title:"编号",field:"logId"},
                    {title:"管理员id",field:"adminId"},
                    {title:"时间",field:"logDate"},
                    {title:"内容",field:"logContent"},
                    {title:"类型",field:"logType"},
                    {title:"地址",field:"logIp"},
                    {title:"操作",templet:"#caoZuo"}
                ]]
            });
        });




        //搜索操作
        function doSearch () {

            //获取用户输入的内容
            var value = $("#lname").val();

            //发送请求 并且接收数据
            layui.use('table',function(){

                var table = layui.table;
                //reload方法完成数据的重新加载
                table.reload('myTable',{
                    //发送的额外参数
                    where:{"content":value}
                });
            });


        }


        // function doSelectOrder(){
        //
        //     var value=$("#op").val();
        //    alert(value);
        // }

        layui.use(['form','layer','table'],function(){
            var form =  layui.form;
            var layer = layui.layer;
            var table = layui.table;
            table.reload("myTable");
            form.verify({
                //dName:function(value,item) {//value：输入框里面的值 item：DOM对象


              //  }

            });


            //当点击提交按钮的时候，会进入到这个函数


            table.on('tool(test)',function(obj){

                // var data = obj.data();
                // var  iayEvent = obj.event;
                // var tr = obj.tr;




                // console.log(iayEvent);
                // console.log(tr);
            });


        })


        $(function () {




            $("#op").change(function () {

                var value = $(this).val();
                alert(value);
            });

        });
















function hha() {

   var value= $(this).val();
   alert(value);
}

    </script>



    <style type="text/css">
        .layui-table-cell{
            height: auto;
            line-height: 50px;
        }

    </style>
   
</head>
<body>

<table id="myTable" lay-data="{id:'myTable'}" >

</table>


<div id="mytoolbar"  style="display: none">






    <div class="layui-inline">
        <label class="layui-form">内容</label>
        <div class="layui-input-inline" style="width: 200px">
            <input type="text"  placeholder="请输入要查询的内容" class="layui-input" id="lname">
        </div>
    </div>
    <div class="layui-input-inline" style="width:100px">
        <button type="button" class="layui-btn layui-btn-normal" onclick="doSearch()">
            <i class="layui-icon layui-icon-search"></i> 搜索
        </button>
    </div>

    <div class="layui-input-inline" >
      <select name="op" id="op" onchange="hha()" >
          <option value="select">查询</option>
          <option value="delete">删除</option>
          <option value="insert">添加</option>
          <option value="update">修改</option>
      </select>
    </div>
</div>









</body>
</html>
